﻿using Apewer.Internals;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Text;

namespace Apewer
{

    /// <summary>冗余异常。</summary>
    public class RedundanceException : Exception
    {

        private string _name;
        private string _message;

        /// <summary></summary>
        public RedundanceException(string name)
        {
            _name = name ?? "";
            _message = "";
        }

        /// <summary></summary>
        public RedundanceException(string name, string message)
        {
            _name = name ?? "";
            _message = message ?? "";
        }

        /// <summary></summary>
        public string Name { get { return _name; } }

        /// <summary></summary>
        public override string Message { get { return _message; } }

        /// <summary>从 <see cref="RedundanceException"/> 到 Boolean 的隐式转换，判断 <see cref="RedundanceException"/> 有效。</summary>
        public static implicit operator bool(RedundanceException instance) => instance != null;

    }

}
